#ifndef C0_CODEGENERATOR_H
#define C0_CODEGENERATOR_H

#include "main.h"
#include <queue>
#include <stack>

extern int bl;

class CodeGenerator : public ast::Visitor {
public:
    CodeGenerator() = default;

    static void entry();

    static void showCode();

    explicit CodeGenerator(past node) : node(node) {}

    void visit(VarDef *) override {};

    void visit(FuncDef *) override;

    void visit(UnaryExp *) override;

    void visit(CompUnit *) override;

    void visit(Decl *) override;

    void visit(expr *) override {};

    void visit(parameter *) override {};

    void visit(Assign_Stmt *) override;

    void visit(Block_list *) override {};

    void visit(FuncRParams_list *) override {};

    void visit(FuncDef_para *) override {};

    void visit(Return_Stmt *) override;

    void visit(IfElse_Stmt *) override;

    void visit(VarDecl_list *) override {};

    void visit(type *) override {};

    void visit(intValue *) override {};

    void visit(VarDecl *) override {};

    void visit(If_Else *) override;

    void visit(While_Stmt *) override;

private:
    past node{};
};


#endif //C0_CODEGENERATOR_H
